<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/wroteit','App\Http\Controllers\WroteitController@main')->name('main');
Route::get('/wroteit/messages','App\Http\Controllers\WroteitController@messages_main')->name('messages_main');
Route::get('/wroteit/messages/send','App\Http\Controllers\WroteitController@messages_send')->name('messages_send');
Route::post('/wroteit/messages/send','App\Http\Controllers\WroteitController@store_new_message')->name('store_new_message');
Route::get('/wroteit/messages/receive','App\Http\Controllers\WroteitController@messages_receive')->name('messages_receive');
Route::get('/wroteit/messages/receive/mail={mes}','App\Http\Controllers\WroteitController@show_message')->name('show_message');
Route::get('/wroteit/messages/send/new_message','App\Http\Controllers\WroteitController@new_message')->name('new_message');
Route::get('/wroteit/messages/send/mail={mes}','App\Http\Controllers\WroteitController@show_message2')->name('show_message2');
Route::get('/wroteit/subtopic/new_subtopic','App\Http\Controllers\WroteitController@new_subtopic')->name('new_subtopic');
Route::post('/wroteit','App\Http\Controllers\WroteitController@store_new_subtopic')->name('store_new_subtopic');

Route::get('logout','App\Http\Controllers\LoginController@logout')->name('logout');

//topic-post-stuff-etc
Route::get('/w/{sub}/{post_id}','App\Http\Controllers\PostController@showPost')->name('show_post');
Route::get('/w/{sub}','App\Http\Controllers\WroteitController@show_topic')->name('show_topic');
Route::get('/subscribe/{sub}','App\Http\Controllers\PostController@subscribe')->name('subscribe');
Route::get('/list/subscriptions','App\Http\Controllers\PostController@showSubscriptions')->name('list_subscriptions');
Route::get('/list/all_topics','App\Http\Controllers\PostController@showTopics')->name('list_all_topics');

//new post stuff
Route::get('/newpost/{sub}','App\Http\Controllers\PostController@newPost')->name('new_post');
Route::post('/wroteit','App\Http\Controllers\PostController@storeNewPost')->name('store_new_post');

Route::middleware(['auth:sanctum', 'verified'])->get('/dashboard', function () {
    return view('dashboard');
})->name('dashboard');
